﻿@using LunwenYun.Infrastructure.Entities.Entity;
@{
    Layout = "/Views/Shared/_admin.cshtml";
}
<!-- content -->
<div class="container">
    <div class="container">
        <div class="row">
            <div class="span3">
               @Html.Partial("/Views/Shared/Partial/_admin_leftmanu.cshtml")
            </div>
            <div class="span9">
                <blockquote>
                    <p>
                        <strong>约稿人申请</strong></p>
                </blockquote>
                <hr />
                <table class="table table-hover">
                    <thead style="border-bottom:1px solid #ccc;">
                        <tr>
                            <th>
                                申请期刊
                            </th>
                            <th style="width: 25%">
                                申请人
                            </th>
                            <th style="width: 15%">
                                申请时间
                            </th>
                            <th style="width: 18%">
                            </th>
                        </tr>
                    </thead>
                    <tbody>
                        @{
                            ItemListBox<ApplySheet> data = ViewBag.ApplySheet;
                            if (data != null && data.Data != null && data.Data.Any())
                            {
                                foreach (var item in data.Data)
                                {
                            <tr>
                                <td>
                                    <a target="_blank" href="/j/index/@item.Periodical.Id">《@item.Periodical.Name》</a>
                                </td>
                                <td>
                                    @item.User.NickName (@item.User.UserName)
                                </td>
                                <td>
                                    @item.ApplyDate.ToString("yyyy-MM-dd")
                                </td>
                                <td>
                                    <a target="_blank" href="/admin/applydetail/@item.Id" class="btn btn-mini">查看</a>
                                    <div class="btn-group btn-mini">
                                        <button data-toggle="dropdown" class="btn btn-primary btn-mini dropdown-toggle">
                                            操作 <span class="caret"></span>
                                        </button>
                                        <ul class="dropdown-menu">
                                            <li><a href="javascript:;" onclick="agreeApply(@item.Id,this)">同意</a></li>
                                            <li><a href="javascript:;" onclick="refuseApply(@item.Id,this)">拒绝</a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                                }
                            }
                        }
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</div>
@section tail{
    <script type="text/javascript">
        $(function () {
            $('#likcenter').addClass('active');
            $('#likeditorapply').addClass('active');
        });
        function agreeApply(id, sender) {
            if (confirm('确定同意此申请吗？')) {
                $.ajax({
                    url: '/admin/agreeApply',
                    data: { id: id },
                    success: function (res) {
                        if (res == '1') {
                            alert('操作成功');
                            $(sender).parent().parent().parent().parent().parent().remove();
                        }
                    }
                });
            }
        }
        function refuseApply(id, sender) {
            if (confirm('确定拒绝此申请吗？')) {
                $.ajax({
                    url: '/admin/refuseApply',
                    data: { id: id },
                    success: function (res) {
                        if (res == '1') {
                            alert('操作成功');
                            $(sender).parent().parent().parent().parent().parent().remove();
                        }
                    }
                });

            }
        }
    </script>
}
